#!/bin/bash
#
#说明
#
#


mkdir pb
mkdir pb/common
mkdir pb/games
cd proto
protofiles=`ls | grep [.]proto`
cd common
common=`ls | grep [.]proto`
cd ../
cd games
games=`ls | grep [.]proto`
cd ../../

for f in ${common[*]}
do
    chmod u+x ./protoc
    ./protoc "proto/common/"$f -o "pb/common/"${f/".proto"/".pb"}

    echo " generate" ${f/".proto"/".pb"} done !
done
for f in ${protofiles[*]}
do
    chmod u+x ./protoc
    ./protoc "proto/"$f -o "pb/"${f/".proto"/".pb"}

    echo " generate" ${f/".proto"/".pb"} done !
done

for f in ${games[*]}
do
    chmod u+x ./protoc
    ./protoc "proto/games/"$f -o "pb/games/"${f/".proto"/".pb"}

    echo " generate" ${f/".proto"/".pb"} done !
done

# cp -f *.pb pb
rm -f *.pb
